package com.rd.student.jike.class1.sunhao.exam;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        Writer writer = new FileWriter("Sutdent.txt");
        BufferedWriter bufferedWriter = new BufferedWriter(writer);
        String str ="姓名  语文成绩  数学成绩   总分\n";
        bufferedWriter.write(str);
        Scanner scanner = new Scanner(System.in);
        for (int i=0;i<3;i++){
            System.out.println("请输入第"+(i+1)+"个学生的姓名、数学成绩、语文成绩");
            String name=scanner.next();
            int Chasore=scanner.nextInt();
            int Mathsore=scanner.nextInt();
            Student student = new Student(name,Chasore,Mathsore);
            String str1=student.name+"   "+student.Chasore+"   "+student.Mathsore+"   "+student.Zsore+"   \n";
            bufferedWriter.write(str1);
        }
        bufferedWriter.close();
    }
}

class Student{
    String name;

    public Student(String name, int chasore, int mathsore) {
        this.name = name;
        this.Chasore = chasore;
        this.Mathsore = mathsore;
        this.Zsore=chasore+mathsore;
    }

    int Chasore;
    int Mathsore;
    int Zsore;

}